home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Franz PD / Franz PD Disk #279 (1993)(Rhein-Sieg-Soft).zip / Franz PD Disk #279 (1993)(Rhein-Sieg-Soft).adf / ak_gen0-lib_V38.20.LHA / ak_gen0-library / Programmers.LHA / Programmers / Examples / ModeReq.c < prev    next >
C/C++ Source or Header  |  1993-06-26  |  2KB  |  74 lines

  1.  
  2.  /* ModeReq V37.83                                             */
  3.  /* FREEWARE.                                                  */
  4.  /* (c) 1993 by Andreas R. Kleinert.                           */
  5.  /* Demonstrates use of the "ak_gen0.library"'s ModeRequester. */
  6.  /* (using the extended Requester-Functions of V37+)           */
  7.  /* Also opening of windows is demonstrated.                   */
  8.  /* Written in SAS/C V6.00 for OS V2.04 (V37) Includes.        */
  9.  
  10. #include <ak_gen0/ak_gen0_pragma.h>
  11.  
  12. #include <stdlib.h>
  13.  
  14. #include <proto/exec.h>
  15. #include <proto/dos.h>
  16. #include <proto/intuition.h>
  17.  
  18. void main(long argc, char **argv) /* MAIN */
  19. {
  20.  struct Window       *tst_win = N;
  21.  struct AK_ModeEntry *me_ptr  = N;
  22.  
  23.  IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 0);
  24.  
  25.   /* will always be open because of version==0 */
  26.  
  27.  printf("\nModeReq V37.83, FREEWARE, (c) 1993 by Andreas R. Kleinert.\n");
  28.  
  29.  AKBase = (struct AKBase *) OpenLibrary("ak_gen0.library", 37); /* minimum */
  30.  if(AKBase)
  31.   {
  32.    tst_win = AK_Window( 0, 0, 640, 256, 1, 2, N, (ACTIVATE|WINDOWSIZING|NOCAREREFRESH|SIMPLE_REFRESH), N, N, "Test-Window", N, N, 640, 256, 640, 256, WBENCHSCREEN);
  33.    if(tst_win)
  34.     {
  35.      struct AK_Requester *ak_req = N;
  36.  
  37.      ak_req = AK_AllocRequester(AK_REQTYPE_MODE);  /* Allocate Requester */
  38.      if(ak_req)
  39.       {
  40.        ak_req->akr_Window     = CURRENT_WINDOW; /* optional */
  41.        ak_req->akr_OKText     = " Take ";       /* optional */
  42.        ak_req->akr_CancelText = " Quit ";       /* optional */
  43.        ak_req->akr_LeftEdge   = 75;             /* optional */
  44.        ak_req->akr_TopEdge    = 25;             /* optional */
  45.  
  46.        me_ptr = AK_ModeRequest(ak_req);
  47.        if(me_ptr)
  48.         {
  49.          printf("\n Selected Mode is %s (%ldx%ld, %ld Colors).\n", 
  50.           me_ptr->ModeName, me_ptr->MaxWidth, me_ptr->MaxHeight, 1<<me_ptr->MaxDepth);
  51.  
  52.          FreeMem(me_ptr, me_ptr->Length);
  53.         }else
  54.         {
  55.          printf("\n No Mode selected.\n");
  56.         }
  57.  
  58.        AK_FreeRequester(ak_req);                    /* Free Requester */
  59.       }
  60.  
  61.      CloseWindow(tst_win);
  62.     }
  63.  
  64.    CloseLibrary((APTR) AKBase);
  65.   }else
  66.   {
  67.    printf("\n Can't open \42ak_gen0.library\42 V37+ !\n");
  68.   }
  69.  
  70.  CloseLibrary((APTR) IntuitionBase);
  71.  
  72.  exit(0);
  73. }
  74.